﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace PriceCuttingWar
{
	public partial class UIEndMessageBox : UserControl
	{
		public UIEndMessageBox()
		{			
			InitializeComponent();
            GSystem.UIEndMessageBox = this;
            Ani_Hide.Completed += new EventHandler(Ani_Hide_Completed);
            Btn_PlayAgin.MouseLeftButtonDown += new MouseButtonEventHandler(Btn_PlayAgin_MouseLeftButtonDown);
            this.CacheMode = new BitmapCache();
		}
        void Btn_PlayAgin_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Ani_Hide.Begin();
            //重玩

        }
        void Ani_Hide_Completed(object sender, EventArgs e)
        {
            GSystem.Root.StartInterfaceShow();
            this.Visibility = Visibility.Collapsed;
        }
        public void ShowThisInterface(int score)
        {
            this.Visibility = Visibility.Visible;
            ScoreSum.Text = score.ToString();
            int hs = GSystem.HighestScore.GetHighestScore(GSystem.GameMode);
            if (score > hs)
            {
                GSystem.HighestScore.SaveHighestScore(GSystem.GameMode, score);
                HighScore.Text = score.ToString();
            }
            else
                HighScore.Text = hs.ToString();

            Ani_SHow.Begin();
        }
        public void HideThisInterface()
        {
            Ani_Hide.Begin();
        }
	}
}